package org.example.bean;

/**
 * 饿汉式-线程安全
 * @author: yh
 * @date: 2022/12/11
 */
public class SingletonThreadSafe {
    private static SingletonThreadSafe uniqueInstance = new SingletonThreadSafe();

    private SingletonThreadSafe() {
    }

    public static SingletonThreadSafe getUniqueInstance() {
        if (uniqueInstance == null) {
            uniqueInstance = new SingletonThreadSafe();
        }
        return uniqueInstance;
    }
}
